package cn.tedu.charging.order.controller;

import cn.tedu.charging.common.pojo.param.OrderAddParam;
import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    //扫码下单
    @PostMapping("/order/create")
    public JsonResult<String> createOrder(@RequestBody OrderAddParam param){
        //调用业务层 获取本次扫码下单业务生成的订单编码
        //billId|orderNo 属性名称描述的都是同一个东西 订单编码
        String billId=orderService.createOrder(param);
        return JsonResult.ok(billId);
    }
}
